﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Caching;

namespace _18miljard.TextLinks
{
	public class TextLinkCache
	{
		internal static TextLinkCollector TextLinks
		{
			get
			{
				string cacheName = "data_textlinks";

				TextLinkCollector links = DataCache.Cache[cacheName] as TextLinkCollector;

				if (links == null)
				{
					links = new TextLinkCollector();

					CacheDependency dependency = new CacheDependency(HttpContext.Current.Server.MapPath("/App_Data/TextLinks.xml"));

					DataCache.ExpireNextDay(cacheName, links, dependency);
				}

				return links;
			}
		}
	}
}
